﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using STLGROUP.Layers;
using STLGROUP.Layers.DataAccessLayers;
using QuanLyBanHang.SystemForms;
using STLGROUP.Layers.Common;

namespace QuanLyBanHang
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //load plash form
            frmPlash frmplash = new frmPlash();
            Application.Run(frmplash);

            if (frmplash.DialogResult == DialogResult.OK)
            {
#if !DEBUG
                ACL_TaiKhoan rootUser = new ACL_TaiKhoan() { IDTaiKhoan = 0, TenDangNhap = "root", MatKhau = "qlbh100", IDNhomNguoiDung = 1 };
                UICommon.CurrentUserInfo = rootUser;

                //load from login
                frmLogin frmLogin = new SystemForms.frmLogin();
                Application.Run(frmLogin);

                if (frmLogin.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                frmMainMenu frm = new frmMainMenu();
                Application.Run(frm);
                
#else
                ACL_TaiKhoan rootUser = new ACL_TaiKhoan() {IDTaiKhoan=0, TenDangNhap="root", MatKhau="qlbh100", IDNhomNguoiDung=1};
                UICommon.CurrentUserInfo = rootUser;

                 //frmMainMenu frm = new frmMainMenu();
                 //Application.Run(frm);

                 //load from login
                frmLogin frmLogin = new SystemForms.frmLogin();
                Application.Run(frmLogin);

                if (frmLogin.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                frmMainMenu frm = new frmMainMenu();
                Application.Run(frm);
#endif

            }
        }
    }
}
